<template>
  <Spin :spinning="loading" tip="Loading...">
  <div>
    <!-- table -->
    <!-- 质量报告查询 - 明细 -->
    <BreakSpace label="质量信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel1" :list="formList" :cols="3" :formType="'add'" labelWidth="120" :isSubmitBtn="false" @formChange="formChangeHandle" />
    <BaseDialog :visible.sync="weixiugongdan" :title="'维修工单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <SelectWeiXiuGongDan @close="weixiugongdanClose" @save="weixiugongdanSave"></SelectWeiXiuGongDan>
    </BaseDialog>
    <BaseDialog :visible.sync="zhusunjian" :title="'主损件选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectzhusunjian @close="zhusunjianClose" @save="zhusunjianSave"></Selectzhusunjian>
    </BaseDialog>
    <BaseDialog :visible.sync="guzhangxianxiangdaima" :title="'故障现象选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Selectguzhangxianxiang @close="guzhangxianxiangdaimanClose" @save="guzhangxianxiangdaimaSave"></Selectguzhangxianxiang>
    </BaseDialog>
    <BaseDialog :visible.sync="application" :title="'索赔单选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <SelectClaimApplication @close="applicationClose" @save="applicationSave"></SelectClaimApplication>
    </BaseDialog>
    <BaseDialog :visible.sync="peijianhuanxiajianlistaddflag" :title="'配件换下件列表新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Peijianhuanxiajianlist @close="peijianhuanxiajianClose" @save="peijianhuanxiajianSave"></Peijianhuanxiajianlist>
    </BaseDialog>
    <BaseDialog :visible.sync="fault" :title="'故障件新增'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <Fault @close="faultClose" @save="faultSave"></Fault>
    </BaseDialog>
    <BaseDialog :visible.sync="caseNoFlag" :title="'案例选择'" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <SelectCaseNo @close="caseNoClose" @save="caseNoSave" :partCode="partCode"></SelectCaseNo>
    </BaseDialog>
    <BaseDialog :visible.sync="ModelVisible" :title="'车型选择'" destroyOnClose width="850px" :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <ModelVehicle @close="modelClose" @save="modelSave"></ModelVehicle>
    </BaseDialog>
    <BaseDialog :visible.sync="backPartVisible" :title="'紧急下发收件维护'" destroyOnClose width="70%" :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <backPart @close="backPartClose" :rowDate="rowDate"></backPart>
    </BaseDialog>
    <div style="margin-bottom: 1rem"></div>
    <BreakSpace label="故障码列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="table1"
      :columns="columns"
      :params="fetchParams"
      :datakey="'records'"
      :onColumnsChange="(columns) => (this.columns = columns)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      height="auto"
      :isSelectColumn="false"
      :isPagination="false"
      ><template slot="controls" slot-scope="props">
        <!--      <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="faultAdd()">添加</multiuse-button>-->
      </template></FilterTable
    >
    <div style="margin-bottom: 1rem"></div>
    <BreakSpace label="换下件配件列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="table2"
      :columns="columns2"
      :params="fetchParams"
      :datakey="'records'"
      :onColumnsChange="(columns2) => (this.columns2 = columns2)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      height="auto"
      :isSelectColumn="false"
      :isPagination="false"
    >
      <template slot="controls" slot-scope="props">
        <!--      <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="peijianhuanxiajianadd()">添加</multiuse-button>-->
      </template></FilterTable
    >
    <div style="margin-bottom: 1rem"></div>
    <FormPanel ref="formPanel2" :list="formList1" :cols="3" :formType="'add'" labelWidth="140" :isSubmitBtn="false" @formChange="formQuaChangeHandle" />
    <BreakSpace label="归档信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel3" :list="formList2" :cols="3" :formType="'add'" labelWidth="110" :isSubmitBtn="false" @formChange="formBackChangeHandle" />

    <BreakSpace label="故障码列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="table3"
      :columns="columns3"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="(columns3) => (this.columns3 = columns3)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      height="auto"
      :isPagination="false"
      :isSelectColumn="false"
    >
    </FilterTable>
    <div style="margin-bottom: 1rem"></div>
    <BreakSpace label="主损配件列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="table4"
      :columns="columns4"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="(columns4) => (this.columns4 = columns4)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      height="auto"
      :isPagination="false"
      :isSelectColumn="false"
    >
    </FilterTable>
    <LazyLoadTab v-model="activeName" :tabMenus="menus" :destroyOnClose="true"></LazyLoadTab>
    <FormPanel ref="formPanel4" :list="formList3" :cols="3" :formType="'add'" labelWidth="110" :isSubmitBtn="false" @formChange="formAuditChangeHandle" />

    <!--    <BreakSpace label="历史审核记录" :containerStyle="{ marginBottom: '10px' }"/>-->
    <!--    <FilterTable-->
    <!--      ref="table3"-->
    <!--      :columns="columns3"-->
    <!--      :params="fetchParams"-->
    <!--      :datakey="'items'"-->
    <!--      :onColumnsChange="columns => (this.columns3 = columns3)"-->
    <!--      :onRowSelectChange="selectChange"-->
    <!--      selectionType="single"-->
    <!--    ></FilterTable>-->
    <div style="margin-bottom: 1rem"></div>
    <div
      :style="{
        position: 'fixed',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right',
      }"
    >
      <multiuse-button type="primary" @click="closeDialog">关 闭</multiuse-button>
    </div>
    <div style="margin-bottom: 4rem"></div>
  </div>
  </Spin>
</template>
<script>
import SelectWeiXiuGongDan from '../../BasicData/ClaimApplication/SelectWeiXiuGongDan';
import { getPartType } from '@/api/dictionary/index';
import Selectzhusunjian from '../../BasicData/ClaimApplication/Selectzhusunjian';
import Selectguzhangxianxiang from '../../BasicData/ClaimApplication/Selectguzhangxianxiang';
import SelectClaimApplication from '@/pages/claimDemage/QualityInformationManagement_OEM/QualityInformationExamine/SelectClaimApplication';
import { quySP } from '@/api/claim/dealer/ClaimApplication/index';
import Fault from '@/pages/claimDemage/QualityInformationManagement_OEM/QualityInformationExamine/Fault.vue';
import SelectCaseNo from '@/pages/claimDemage/QualityInformationManagement_OEM/QualityInformationExamine/SelectCaseNo';
import { isFormEmpty } from '@/utils/index';
import Peijianhuanxiajianlist from '../../BasicData/ClaimApplication/Peijianhuanxiajianlist';
import { quyRpQaReportHandle, getCaseId, approveByPtId } from '@/api/claim/factory/QualityInformationManagement_OEM/QualityInformationExamine/index';
import { copyUpdateData } from '@/utils/index';
import ModelVehicle from '@/pages/claimDemage/tools/ModelVehicle.vue';
import moment from 'moment';
import { dictionary } from '@/utils/dictMixin';
import backPart from '@/pages/claimDemage/QualityInformationManagement_OEM/QualityInformationExamine/backPart.vue';
export default {
  props: ['type', 'rowData'],
  mixins: [dictionary],
  components: {
    SelectWeiXiuGongDan,
    Selectzhusunjian,
    Selectguzhangxianxiang,
    SelectClaimApplication,
    Peijianhuanxiajianlist,
    Fault,
    SelectCaseNo,
    ModelVehicle,
    backPart
  },
  data() {
    return {
      loading: false,
      collapse: false,
      infoId: null,
      columns: this.creatHeader(),
      columns2: this.creatHeader2(),
      columns3: this.creatHeader3(),
      columns4: this.creatHeader4(),
      // columns3: this.creatHeader3(),
      // topFilterInit: this.topFilterInitFun(),
      // fetchApi: getUser,
      fetchParams: {}, //ipa 接口
      selectedRows: [], //选中经销商
      formList: this.createFormList(),
      formList1: this.QuaformList(),
      formList2: this.backFormList(),
      formList3: this.aduitFormList(),
      saveData: null,
      saveData1: null,
      saveData2: null,
      saveData3: null,
      weixiugongdan: false,
      zhusunjian: false,
      guzhangxianxiangdaima: false,
      application: false,
      peijianhuanxiajianlistaddflag: false,
      fault: false,
      activeName: '审核记录',
      caseNoFlag: false,
      ModelVisible: false,
      partCode:null,
      backPartVisible:false,
      rowDate:null,
      menus: [
        {
          title: '审核记录',
          path: 'claimDemage/QualityInformationManagement_OEM/QualityInformationExamine/jiluandlishi/shenhejilu',
          params: {
            type: 1,
            // reportId: this.rowData.reportId,
          },
        },
        {
          title: '维修历史',
          path: 'claimDemage/QualityInformationManagement_OEM/QualityInformationExamine/jiluandlishi/weixiulishi',
          // disabled: true,
          params: {
            type: 2,
          },
        },
        {
          title: '索赔历史',
          path: 'claimDemage/QualityInformationManagement_OEM/QualityInformationExamine/jiluandlishi/suopeilishi',
          // disabled: true,
          params: {
            type: 3,
            roNo: this.roNo,
          },
        },
      ],
    };
  },
  async created() {
    console.log(this.rowData.reportNo,'this.rowData.reportNo')
    this.loading = true;
    await this.chuqi();
    await this.getList(this.rowData.reportNo);
    this.loading = false;
  },
  methods: {
    async chuqi() {
      // console.log('进来了');
      // const res1 = await getPartType({ type: 5561 });
      // if (res1.resultCode == 200) {
      //   this.formList.find((x) => x.fieldName == 'reportStatus').itemList = res1.data.map((y) => ({
      //     text: y.codeCnDesc,
      //     value: y.codeId,
      //   }));
      // }
      // const res2 = await getPartType({ type: 5533 });
      // if (res2.resultCode == 200) {
      //   this.formList1.find((x) => x.fieldName == 'ifQualified').itemList = res2.data.map((y) => ({
      //     text: y.codeCnDesc,
      //     value: y.codeId,
      //   }));
      // }
      // const res3 = await getPartType({ type: 5563 });
      // if (res3.resultCode == 200) {
      //   this.formList2.find((x) => x.fieldName == 'caseLevel').itemList = res3.data.map((y) => ({
      //     text: y.codeCnDesc,
      //     value: y.codeId,
      //   }));
      // }
      // const res5 = await getPartType({ type: 5500 });
      // if (res5.resultCode == 200) {
      //   this.formList.find((x) => x.fieldName == 'isKeep').itemList = res5.data.map((y) => ({ text: y.codeCnDesc, value: y.codeId }));
      // }
    },
    async getList(reportNo) {
      let res = await quyRpQaReportHandle({ reportNo: reportNo });
      let data = res.data;
      this.rowDate = data;
      //临时属性
      this.partId = data.partId; //主损件id
      this.partCode = data.partCode; //主损件代码
      this.supCode = data.supCode; //供应商Code
      this.modelId = data.modelId; //车型id
      this.modelCode = data.modelCode; //车型Code
      this.faultId = data.faultId; //故障现象主键
      // this.faultIdCase = data.caseDTO == undefined?null:data.caseDTO.faultId; //故障现象主键
      this.isDeleted = data.isDeleted;
      this.applyAt = data.applyAt;
      this.cmsClaimId = data.cmsClaimId;
      this.claimStatus = data.claimStatus;
      // this.prodDate = data.prodDate;
      this.menus[2].params.roNo = data.vin;
      //为2个form赋值

      for (let i in data) {
        // console.log(data.fileList);
        let fileList = [];
        this.formList.map((y) => {
          if (y.fieldName == 'fileList') {
              data.fileList.map(f=> {
                fileList.push({name: f.title, url: f.fileUrl});
              });
            y.initialValue = fileList || [];
          } else if (i == y.fieldName) {
            y.initialValue = data[i];
          }
        });
      }
      for (let i in data) {
        this.formList1.map((y) => {
          if (i == y.fieldName) {
            y.initialValue = data[i];
          }
        });
      }

      for (let i in data.caseDTO) {
        if (data.caseDTO) {
          this.formList2.map((y) => {
            if (i == y.fieldName) {
              y.initialValue = data.caseDTO[i];
              y.disabled = true;
            }
            if (y.fieldName == 'file1List') {
              if (data.caseDTO.file1List) {
                y.initialValue = data.caseDTO.file1List.map((f) => ({ name: f.title, url: f.fileUrl }));
              }
            }
          });
        }
      }

      for (let i in data) {
        this.formList3.map((y) => {
          if (i == y.fieldName) {
            y.initialValue = data[i];
          }
        });
      }
      if (data.caseDTO) {
        let fileIds = [];
        data.caseDTO.file1List.map((x) => {
          fileIds.push(x.fileId);
        });
        let idsss = '';
        fileIds.map((x) => {
          idsss += x + ',';
        });
        this.fileIds = idsss;
      }

      //为table赋值

      if (200 == res.resultCode) {
        let data = res.data;
        if (isFormEmpty(data)) {
          data = {};
        }
        // let records1 = data.logList;
        // if (isFormEmpty(records1)) {
        //   records1 = [];
        // }
        // this.$refs.table3.$refs.pageTable.EXECUTE_INSERT(records1);
      }
      let records2 = data.partList;
      if (isFormEmpty(records2)) {
        records2 = [];
      }
      let partIds = [];
      this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(records2);
      this.$refs.table2.$refs.pageTable.list.map((x) => {
        partIds.push(x.partId);
      });
      let ids = '';
      partIds.map((x) => {
        ids += x + ',';
      });
      this.partIds = ids;
      let records3 = data.faultList;
      if (isFormEmpty(records3)) {
        records3 = [];
      }
      let faultIds = [];
      this.$refs.table1.$refs.pageTable.EXECUTE_INSERT(records3);
      this.$refs.table1.$refs.pageTable.list.map((x) => {
        faultIds.push(x.faultId);
        this.faultIds = faultIds;
      });
      let idss = '';
      faultIds.map((x) => {
        idss += x + ',';
      });
      this.faultIds = idss;

      let records4 = data.caseDTO ? data.caseDTO.faultList : [];
      // if (isFormEmpty(records4)) {
      //   records4 = [];
      // }
      this.$refs.table3.$refs.pageTable.EXECUTE_INSERT(records4);

      let records5 = data.caseDTO ? data.caseDTO.partList : [];
      // let records5 = data.caseDTO.partList;
      // if (isFormEmpty(records5)) {
      //   records5 = [];
      // }
      this.$refs.table4.$refs.pageTable.EXECUTE_INSERT(records5);
      console.info(res);
      this.newVar = data;
    },
    faultAdd() {
      this.fault = true;
    },
    faultSave(val) {
      this.$refs.table1.$refs.pageTable.EXECUTE_INSERT(val);
      this.fault = false;
    },
    faultClose() {
      this.fault = false;
    },
    backPart(){
      this.backPartVisible = true;
    },
    //提交
    async submit() {
      this.saveFlag = 1;
      this.$refs.formPanel1.SUBMIT_FORM();
      this.$refs.formPanel2.SUBMIT_FORM();
      this.$refs.formPanel3.SUBMIT_FORM();
      this.$refs.formPanel4.SUBMIT_FORM();
      let arr1 = [];
      this.$refs.table2.$refs.pageTable.list.map((x) => {
        delete x.partId;
        arr1.push(x);
      });
      console.log(arr1);

      let arr2 = [];
      this.$refs.table1.$refs.pageTable.list.map((x) => {
        delete x.faultId;
        arr2.push(x);
      });
      console.log(arr2);

      //故障
      this.saveData.faultList = arr2;
      //换下件
      this.saveData.partList = arr1;

      this.saveData = Object.assign(this.saveData, this.saveData1);
      this.saveData = Object.assign(this.saveData, this.saveData3);
      let file1List = [];
      this.saveData2.file1List.map((x) => {
        file1List.push({ title: x.name, fileUrl: x.url });
      });
      this.saveData.fileIds = this.fileIds;
      this.saveData.file1List = file1List;
      this.saveData.caseDTO = this.saveData2;
      if(this.saveData2.createdAt){
        this.saveData2.createdAt = moment(this.saveData2.createdAt).format('YYYY-MM-DD HH:mm:ss');
      }
      this.saveData.caseDTO.faultId = this.faultIdCase;
      console.log("%%%%%%%%%%%",this.faultIdCase)
      this.saveData.caseDTO.modelId = this.modelId;
      this.saveData.caseDTO.createdBy =  this.createdBy;
      this.saveData.caseDTO.createdAt = this.createdAt==null?null: moment(this.createdAt).format('YYYY-MM-DD HH:mm:ss');
      this.saveData.caseDTO.appId = this.appId;
      this.saveData.caseDTO.orgId = this.orgId;
      this.saveData.caseNo = this.saveData2.caseNo;
      if (this.caseId == null) {
        this.saveData.caseDTO.caseId = this.rowData.caseId;
      } else {
        this.saveData.caseDTO.caseId = this.caseId;
      }
      this.saveData.caseDTO.ownerCode = this.rowData.ownerCode;
      this.saveData.caseDTO.isDeleted = this.rowData.isDeleted;
      //判断是保存还是提交 默认0 提交1
      if (this.saveFlag == 1) {
        this.saveData.reportStatus = 55611006;
      } else if (this.saveFlag == 2) {
        this.saveData.reportStatus = 55611003;
      } else {
        this.saveData.reportStatus = 55611005;
      }
      //保存前格式化时间类型
      //销售日期
      this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
      //保修起始日期
      this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
      //维修开始时间
      this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
      //维修结束时间
      this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
      //自费配件销售日期
      // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
      //生产日期
      this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
      this.newVar.modelId = this.modelId;
      this.newVar.modelCode = this.modelCode;
      this.newVar = copyUpdateData(this.newVar, this.saveData);
      if (this.saveData3 && this.saveData2 && this.saveData1) {
        this.loading = true;
        let res = await approveByPtId(this.newVar);

        if (res.resultCode === 200) {
          this.$emit('save');
          return this.$notify.success({ title: '提示信息', message: '保存成功' });
        } else {
          this.loading = false;
        }
      } else {
        this.loading = false;
        this.$notify.error({ title: '提示信息', message: res.errMsg || '保存失败!' });
      }
    },
    async cancels() {
      this.formList1.find((x) => x.fieldName == 'ifQualified').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'caseTitle').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'modelName').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'caseLevel').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'faultCode').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'faultName').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'caseInfo').rules[0].required = false;
      this.saveFlag = 2;
      this.$refs.formPanel1.SUBMIT_FORM();
      this.$refs.formPanel2.SUBMIT_FORM();
      this.$refs.formPanel3.SUBMIT_FORM();
      this.$refs.formPanel4.SUBMIT_FORM();
      let arr1 = [];
      this.$refs.table2.$refs.pageTable.list.map((x) => {
        delete x.partId;
        arr1.push(x);
      });
      console.log(arr1);

      let arr2 = [];
      this.$refs.table1.$refs.pageTable.list.map((x) => {
        delete x.faultId;
        arr2.push(x);
      });
      console.log(arr2);

      //故障
      this.saveData.faultList = arr2;
      //换下件
      this.saveData.partList = arr1;

      this.saveData = Object.assign(this.saveData, this.saveData1);
      this.saveData = Object.assign(this.saveData, this.saveData3);
      let file1List = [];
      this.saveData2.file1List.map((x) => {
        file1List.push({ title: x.name, fileUrl: x.url });
      });
      this.saveData.fileIds = this.fileIds;
      this.saveData.file1List = file1List;
      this.saveData.caseDTO = this.saveData2;
      this.saveData.caseDTO.createdBy =  this.createdBy;
      this.saveData.caseDTO.createdAt = this.createdAt==null?null: moment(this.createdAt).format('YYYY-MM-DD HH:mm:ss');
      this.saveData.caseDTO.appId = this.appId;
      this.saveData.caseDTO.orgId = this.orgId;
      if(this.saveData2.createdAt){
        this.saveData2.createdAt = moment(this.saveData2.createdAt).format('YYYY-MM-DD HH:mm:ss');
      }
      this.saveData.caseDTO.faultId = this.faultIdCase;
      this.saveData.caseDTO.modelId = this.modelId;
      this.saveData.caseNo = this.saveData2.caseNo;
      if (this.caseId == null) {
        this.saveData.caseDTO.caseId = this.rowData.caseId;
      } else {
        this.saveData.caseDTO.caseId = this.caseId;
      }
      this.saveData.caseDTO.ownerCode = this.rowData.ownerCode;
      this.saveData.caseDTO.isDeleted = this.rowData.isDeleted;
      //判断是保存还是提交 默认0 提交1
      if (this.saveFlag == 1) {
        this.saveData.reportStatus = 55611006;
      } else if (this.saveFlag == 2) {
        this.saveData.reportStatus = 55611003;
      } else {
        this.saveData.reportStatus = 55611005;
      }
      //保存前格式化时间类型
      //销售日期
      this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
      //保修起始日期
      this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
      //维修开始时间
      this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
      //维修结束时间
      this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
      //自费配件销售日期
      // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
      //生产日期
      this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
      this.newVar = copyUpdateData(this.newVar, this.saveData);
      console.log(this.newVar);
      if (this.saveData3 && this.saveData2 && this.saveData1) {

        this.loading = true;
        let res = await approveByPtId(this.newVar);

        if (res.resultCode === 200) {
          this.$emit('save');
          return this.$notify.success({ title: '提示信息', message: '保存成功' });
        } else {
          this.loading = false;
          this.$notify.error({ title: '提示信息', message: res.errMsg || '保存失败!' });
          this.closeDialog();
        }
      } else {
        this.loading = false;
        this.$notify.error({ title: '提示信息', message: res.errMsg || '保存失败!' });
        this.closeDialog();
      }
    },
    //保存
    async saveDialog() {
      this.formList1.find((x) => x.fieldName == 'ifQualified').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'caseTitle').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'modelName').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'caseLevel').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'faultCode').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'faultName').rules[0].required = false;
      this.formList2.find((x) => x.fieldName == 'caseInfo').rules[0].required = false;
      this.formList3.find((x) => x.fieldName == 'checkRemarks').rules[0].required = false;
      this.$refs.formPanel1.SUBMIT_FORM();
      this.$refs.formPanel2.SUBMIT_FORM();
      this.$refs.formPanel3.SUBMIT_FORM();
      this.$refs.formPanel4.SUBMIT_FORM();
      let arr1 = [];
      this.$refs.table2.$refs.pageTable.list.map((x) => {
        delete x.partId;
        arr1.push(x);
      });
      console.log(arr1);

      let arr2 = [];
      this.$refs.table1.$refs.pageTable.list.map((x) => {
        delete x.faultId;
        arr2.push(x);
      });
      console.log(arr2);

      //故障
      this.saveData.faultList = arr2;
      //换下件
      this.saveData.partList = arr1;

      this.saveData = Object.assign(this.saveData, this.saveData1);
      this.saveData = Object.assign(this.saveData, this.saveData3);
      let file1List = [];
      this.saveData2.file1List.map((x) => {
        file1List.push({ title: x.name, fileUrl: x.url });
      });
      this.saveData.fileIds = this.fileIds;
      this.saveData.file1List = file1List;
      if(this.saveData2.createdAt){
        this.saveData2.createdAt = moment(this.saveData2.createdAt).format('YYYY-MM-DD HH:mm:ss');
      }
      this.saveData.caseDTO = this.saveData2;
      this.saveData.caseDTO.faultId = this.faultIdCase;
      this.saveData.caseDTO.modelId = this.modelId;
      this.saveData.caseDTO.createdBy =  this.createdBy;
      this.saveData.caseDTO.createdAt = this.createdAt==null?null: moment(this.createdAt).format('YYYY-MM-DD HH:mm:ss');
      this.saveData.caseDTO.appId = this.appId;
      this.saveData.caseDTO.orgId = this.orgId;
      this.saveData.caseNo = this.saveData2.caseNo;
      if (this.caseId == null) {
        this.saveData.caseDTO.caseId = this.rowData.caseId;
      } else {
        this.saveData.caseDTO.caseId = this.caseId;
      }
      this.saveData.caseDTO.ownerCode = this.rowData.ownerCode;
      this.saveData.caseDTO.isDeleted = this.rowData.isDeleted;
      //判断是保存还是提交 默认0 提交1
      this.saveData.reportStatus = 55611005;
      //保存前格式化时间类型
      //销售日期
      this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
      //保修起始日期
      this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
      //维修开始时间
      this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
      //维修结束时间
      this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
      //自费配件销售日期
      // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
      //生产日期
      this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
      console.log('1', this.saveData);
      // this.saveData.cmsClaimId = this.cmsClaimId
      // this.saveData.partId = this.partId;
      // this.saveData.faultId = this.faultId;
      // this.saveData.faultAppear = this.faultAppear;
      // this.saveData.labourAmount = this.labourAmount;
      // this.saveData.partAmount = this.partAmount;
      this.newVar.modelId = this.modelId;
      this.newVar.modelCode = this.modelCode;
      // this.saveData.isDeleted = this.isDeleted;
      // this.saveData.reportId = this.rowData.reportId;
      // this.saveData.faultIds = this.faultIds;
      // this.saveData.partIds = this.partIds;
      // this.saveData.dealerCode = this.rowData.dealerCode;
      // this.saveData.dealerName = this.rowData.dealerName;
      this.newVar = copyUpdateData(this.newVar, this.saveData);
      console.log('111', this.saveData);
      this.loading = true;
      let res = await approveByPtId(this.newVar);

      if (res.resultCode === 200) {
        this.$emit('save');
        return this.$notify.success({ title: '提示信息', message: '保存成功' });
      } else {
        this.loading = false;
        this.$notify.error({ title: '提示信息', message: res.errMsg || '保存失败!' });
        this.closeDialog();
      }
    },
    //配件换下件列表
    peijianhuanxiajianadd() {
      this.peijianhuanxiajianlistaddflag = true;
    },
    //配件换下件
    peijianhuanxiajianClose() {
      this.peijianhuanxiajianlistaddflag = false;
    },
    peijianhuanxiajianSave(val) {
      this.$refs.table2.$refs.pageTable.EXECUTE_DELETE(this.$refs.table2.$refs.pageTable.list);
      this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(val);
      this.peijianhuanxiajianlistaddflag = false;
    },
    async getAuthListByauthNo(id) {
      let res = await quySP({ id: id });
      let data = res.data;
      let records2 = data.partList;
      if (isFormEmpty(records2)) {
        records2 = [];
      }
      this.$refs.table2.$refs.pageTable.EXECUTE_DELETE(this.$refs.table2.$refs.pageTable.list);
      this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(records2);
    },
    delsFunXj(data) {
      this.$refs.table1.$refs.pageTable.EXECUTE_DELETE([data]);
    },
    selectApplicationCode() {
      this.application = true;
    },
    selectpartCode() {
      this.zhusunjian = true;
    },
    selectRono() {
      this.weixiugongdan = true;
    },
    selectfaultCode() {
      this.guzhangxianxiangdaima = true;
    },
    selectcaseNo() {
      this.caseNoFlag = true;
    },
    formChangeHandle(val) {
      console.log(val);
      this.saveData = val;
    },
    formQuaChangeHandle(val) {
      console.log(val);
      this.saveData1 = val;
    },
    formBackChangeHandle(val) {
      this.saveData2 = val;
    },
    formAuditChangeHandle(val) {
      console.log(val);
      this.saveData3 = val;
    },
    //搜索获取数据
    changeHandle(val) {
      this.fetchParams = val;
      console.log(val);
    },
    //选中
    selectChange(rows) {
      this.selectedRows = rows;
      console.log(this.selectedRows);
    },
    //取消操作
    closeDialog() {
      this.$emit('close', { visible: false, data: this.selectedRows, type: 'close' });
    },
    //维修工单
    weixiugongdanClose() {
      this.weixiugongdan = false;
    },
    guzhangxianxiangdaimanClose() {
      this.guzhangxianxiangdaima = false;
    },
    applicationClose() {
      this.application = false;
    },
    applicationSave(obj) {
      this.formList.find((x) => x.fieldName == 'cmsClaimNo').initialValue = obj[0].claimNo;
      this.cmsClaimId = obj[0].claimId;
      this.getAuthListByauthNo(this.cmsClaimId);
      this.application = false;
    },
    guzhangxianxiangdaimaSave(obj) {
      this.formList2.find((x) => x.fieldName == 'sysCode1').initialValue = obj[0].sysCode1;
      this.formList2.find((x) => x.fieldName == 'sysName1').initialValue = obj[0].sysName1;
      this.formList2.find((x) => x.fieldName == 'sysCode2').initialValue = obj[0].sysCode2;
      this.formList2.find((x) => x.fieldName == 'sysName2').initialValue = obj[0].sysName2;
      this.formList2.find((x) => x.fieldName == 'sysCode3').initialValue = obj[0].sysCode3;
      this.formList2.find((x) => x.fieldName == 'sysName3').initialValue = obj[0].sysName3;
      this.formList2.find((x) => x.fieldName == 'sysCode4').initialValue = obj[0].sysCode4;
      this.formList2.find((x) => x.fieldName == 'sysName4').initialValue = obj[0].sysName4;
      this.formList2.find((x) => x.fieldName == 'faultCode').initialValue = obj[0].faultCode;
      this.formList2.find((x) => x.fieldName == 'faultName').initialValue = obj[0].faultName;
      this.faultIdCase = obj[0].faultId;
      this.guzhangxianxiangdaima = false;
    },
    modelSave(obj) {
      this.formList2.find(x => x.fieldName == 'modelName').initialValue = obj[0].modelName;
      this.modelCode=obj[0].modelCode;
      this.modelId = obj[0].modelId;
      console.log("!!!!!!!!!",this.modelCode)
      this.ModelVisible = false;
    },
    modelClose(){
      this.ModelVisible = false;
    },
    backPartClose(){
      this.backPartVisible = false;
    },
    selectModleCode(){
      this.ModelVisible = true;
    },
    //主损件
    zhusunjianClose() {
      this.zhusunjian = false;
    },
    zhusunjianSave(obj) {
      this.formList.find((x) => x.fieldName == 'partCode').initialValue = obj[0].partCode;
      this.formList.find((x) => x.fieldName == 'partName').initialValue = obj[0].partName;
      this.partId = obj[0].partId;
      this.zhusunjian = false;
    },
    weixiugongdanSave(obj) {
      // this.formList.find(x => x.fieldName == 'claimNo').initialValue = obj[0].claimNo;
      this.formList.find((x) => x.fieldName == 'roNo').initialValue = obj[0].roNo;
      this.formList.find((x) => x.fieldName == 'vin').initialValue = obj[0].vin;
      this.formList.find((x) => x.fieldName == 'modelName').initialValue = obj[0].modelName;
      this.formList.find((x) => x.fieldName == 'saleDate').initialValue = obj[0].saleDate;
      this.formList.find((x) => x.fieldName == 'serviceBeginDate').initialValue = obj[0].serviceBeginDate;
      this.formList.find((x) => x.fieldName == 'serviceEndDate').initialValue = obj[0].serviceEndDate;
      this.formList.find((x) => x.fieldName == 'prodDate').initialValue = obj[0].prodDate;
      this.formList.find((x) => x.fieldName == 'driveMile').initialValue = obj[0].driveMile;
      this.modelCode = obj[0].modelCode;
      this.modelId = obj[0].modelId;
      this.weixiugongdan = false;
    },
    //配件换下件
    caseNoClose() {
      this.caseNoFlag = false;
    },
    async caseNoSave(obj) {
      this.formList2.find((x) => x.fieldName == 'faultCode').initialValue = obj[0].faultCode;
      this.formList2.find((x) => x.fieldName == 'faultName').initialValue = obj[0].faultName;
      this.formList2.find((x) => x.fieldName == 'faultTimes').initialValue = obj[0].faultTimes;
      this.formList2.find((x) => x.fieldName == 'caseNo').initialValue = obj[0].caseNo;
      this.formList2.find((x) => x.fieldName == 'caseTitle').initialValue = obj[0].caseTitle;
      this.formList2.find((x) => x.fieldName == 'modelName').initialValue = obj[0].modelName;
      this.formList2.find((x) => x.fieldName == 'caseLevel').initialValue = obj[0].caseLevel;
      this.formList2.find((x) => x.fieldName == 'caseInfo').initialValue = obj[0].caseInfo;
      this.formList2.find((x) => x.fieldName == 'addviseInfo').initialValue = obj[0].addviseInfo;
      this.formList2.find((x) => x.fieldName == 'createdAt').initialValue = obj[0].createdAt;
      this.caseId = obj[0].caseId;
      let res = await getCaseId({ id: this.caseId });
      let records2 = res.data.partList;
      if (isFormEmpty(records2)) {
        records2 = [];
      }
      this.$refs.table4.$refs.pageTable.EXECUTE_DELETE(this.$refs.table4.$refs.pageTable.list);
      this.$refs.table4.$refs.pageTable.EXECUTE_INSERT(records2);
      let records3 = res.data.faultList;
      if (isFormEmpty(records3)) {
        records3 = [];
      }
      this.$refs.table3.$refs.pageTable.EXECUTE_DELETE(this.$refs.table3.$refs.pageTable.list);
      this.$refs.table3.$refs.pageTable.EXECUTE_INSERT(records3);

      this.formList2.forEach((x) => {
        if (x.fieldName == 'file1List') {
          x.initialValue = res.data.file1List.map((f) => ({ name: f.title, url: f.fileUrl }));
        }
      });
      let fileIds = [];
      res.data.file1List.map((x) => {
        fileIds.push(x.fileId);
      });
      let idsss = '';
      fileIds.map((x) => {
        idsss += x + ',';
      });
      this.fileIds = idsss;
      this.formList2.find((x) => x.fieldName == 'sysCode1').initialValue = res.data.sysCode1;
      this.formList2.find((x) => x.fieldName == 'sysName1').initialValue = res.data.sysName1;
      this.formList2.find((x) => x.fieldName == 'sysCode2').initialValue = res.data.sysCode2;
      this.formList2.find((x) => x.fieldName == 'sysName2').initialValue = res.data.sysName2;
      this.formList2.find((x) => x.fieldName == 'sysCode3').initialValue = res.data.sysCode3;
      this.formList2.find((x) => x.fieldName == 'sysName3').initialValue = res.data.sysName3;
      this.formList2.find((x) => x.fieldName == 'sysCode4').initialValue = res.data.sysCode4;
      this.formList2.find((x) => x.fieldName == 'sysName4').initialValue = res.data.sysName4;
      this.formList2.map((y) => {
        if (y.fieldName == 'caseNo') {
          y.disabled = false;
        } else {
          y.disabled = true;
        }
      });
      this.faultIdCase = res.data.faultId;
      this.createdBy = res.data.createdBy;
      this.createdAt = res.data.createdAt;
      this.appId = res.data.appId;
      this.orgId = res.data.orgId;
      this.modelCode=res.data.modelCode;
      this.caseNoFlag = false;
    },
    //质量信息
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '经销商代码',
          fieldName: 'ownerCode',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '经销商名称',
          fieldName: 'ownerName',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '质量报告单号',
          fieldName: 'reportNo',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '维修工单号',
          fieldName: 'roNo',
          placeholder: '请输入标题名称...',
          disabled: true, // 置会
        },
        {
          type: 'SELECT',
          label: '质量报告状态',
          fieldName: 'reportStatus',
          placeholder: '请输入标题名称...',
          disabled: true, // 只读
          itemList: this.createDictList('5561'),
        },
        {
          type: 'INPUT',
          label: 'VIN',
          fieldName: 'vin',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'DATE',
          label: '生产日期',
          fieldName: 'prodDate',
          valueFormat: 'yyyy-MM-dd',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'DATE',
          label: '销售日期',
          fieldName: 'saleDate',
          valueFormat: 'yyyy-MM-dd',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '行驶里程',
          fieldName: 'driveMile',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '车型名称',
          fieldName: 'modelName',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '制单人',
          fieldName: 'reporterStr',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '联系方式',
          fieldName: 'phone',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '主损件',
          fieldName: 'partCode',
          placeholder: '请输入...',
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '主损件名称',
          fieldName: 'partName',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '索赔单号',
          fieldName: 'cmsClaimNo',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '故障现象代码',
          fieldName: 'faultCode',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '故障现象描述',
          fieldName: 'faultName',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '一级代码',
          fieldName: 'sysCode1',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '一级名称',
          fieldName: 'sysName1',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '二级代码',
          fieldName: 'sysCode2',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '二级名称',
          fieldName: 'sysName2',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '三级代码',
          fieldName: 'sysCode3',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '三级名称',
          fieldName: 'sysName3',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '故障代码',
          fieldName: 'sysCode4',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '故障名称',
          fieldName: 'sysName4',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'SELECT',
          label: '是否留车',
          fieldName: 'isKeep',
          placeholder: '请输入...',
          disabled: true,
          itemList: this.createDictList('5500'),
        },
        {
          type: 'INPUT',
          label: '留车单号',
          fieldName: 'keepCar',
          placeholder: '请输入...',
          disabled: true, // 置会
        },
        {
          type: 'TEXT_AREA',
          label: '故障描述',
          fieldName: 'cmsClaimInfo',
          selfCols: 3, // 元素占据几行
          rows: 3,
          disabled: true, // 置会
        },
        {
          type: 'TEXT_AREA',
          label: '维修经过',
          fieldName: 'cmsClaimProcess',
          selfCols: 3, // 元素占据几行
          rows: 3,
          disabled: true, // 置会
        },
        {
          type: 'TEXT_AREA',
          label: '维修结果',
          fieldName: 'cmsClaimResult',
          selfCols: 3, // 元素占据几行
          rows: 3,
          disabled: true, // 置会
        },
        {
          type: 'TEXT_AREA',
          label: '建议意见',
          fieldName: 'suggestion',
          selfCols: 3, // 元素占据几行
          rows: 3,
          disabled: true, // 置会
        },
        {
          type: 'TEXT_AREA',
          label: '使用环境',
          fieldName: 'useEvn',
          selfCols: 3, // 元素占据几行
          rows: 3,
          disabled: true, // 置会
        },
        {
          type: 'UPLOAD_FILE',
          label: '上传文件',
          fieldName: 'fileList',
          placeholder: '上传文件...',
          initialValue: [],
          disabled: true, // 置会
          upload: {
            actionUrl: '/api/file/oss/upload',
            limit: 3,
            // tipText: '只能上传pdf格式'
          },
        },
      ];
    },
    //故障码列表
    creatHeader() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        // {
        //   title: '操作',
        //   dataIndex: 'column-action',
        //   width: 100,
        //   fixed: 'left',
        //   render: props => {
        //     return (
        //       <div style="text-align:center">
        //       <multiuse-button type="primary" icon="el-icon-delete" onClick={() => this.delsFunXj(props.row)} circle />
        //     </div>
        //   );
        //   }
        // },
        { title: '故障码', dataIndex: 'faultCode', sorter: true },
        { title: '故障码描述', dataIndex: 'faultName', sorter: true },
      ];
    },
    //配件列表
    creatHeader2() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        { title: '配件代码', dataIndex: 'partCode', sorter: true },
        { title: '配件名称', dataIndex: 'partName', sorter: true },
        { title: '单位', dataIndex: 'partUnit', sorter: true },
        { title: '数量', dataIndex: 'partCount', sorter: true },
      ];
    },
    //费用信息
    QuaformList() {
      return [
        {
          type: 'SELECT',
          label: '质量报告是否合格',
          fieldName: 'ifQualified',
          itemList: this.createDictList('5533'),
          rules: [{ required: true, message: '请选择所属分类', trigger: 'change' }],
          width: 120,
        },
        {
          type: 'TEXT_AREA',
          label: '评价',
          fieldName: 'assess',
          selfCols: 2, // 元素占据几行
          rows: 1,
        },
      ];
    },
    backFormList() {
      return [
        {
          type: 'INPUT',
          label: '案例编号',
          fieldName: 'caseNo',
          placeholder: '请输入...',
          readonly: true,// 只读
          unitRender: (p) => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectcaseNo()} />
              </div>
            );
          },
        },
        {
          type: 'INPUT',
          label: '案例主题',
          fieldName: 'caseTitle',
          selfCols: 2, // 元素占据几行
          rules: [{ required: true, message: '请输入案例主题', trigger: 'blur' }],
        },
        {
          type: 'INPUT',
          label: '车型名称',
          fieldName: 'modelName',
          placeholder: '请输入...',
          rules: [{ required: true, message: '请输入车型名称', trigger: 'blur' }],
          unitRender: (p) => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectModleCode()} />
              </div>
            );
          },
        },
        {
          type: 'SELECT',
          label: '故障等级',
          fieldName: 'caseLevel',
          placeholder: '请选择...',
          itemList: this.createDictList('5563'),
          rules: [{ required: true, message: '请选择故障等级', trigger: 'blur' }],
        },
        {
          type: 'INPUT',
          label: '案例创建日期',
          fieldName: 'createdAt',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '故障现象代码',
          fieldName: 'faultCode',
          placeholder: '请输入...',
          readonly: true, // 只读
          rules: [{ required: true, message: '请输入故障现象代码', trigger: 'blur' }],
          unitRender: (p) => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultCode()} />
              </div>
            );
          },
        },
        {
          type: 'INPUT',
          label: '故障现象描述',
          fieldName: 'faultName',
          readonly: true, // 只读
          disabled: true, // 置会
          rules: [{ required: true, message: '请输入故障现象代码', trigger: 'blur' }],
        },
        {
          type: 'INPUT',
          label: '故障次数',
          fieldName: 'faultTimes',
          readonly: true, // 只读
          disabled: true, // 置会
          initialValue: 0,
        },
        {
          type: 'INPUT',
          label: '一级代码',
          fieldName: 'sysCode1',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '一级名称',
          fieldName: 'sysName1',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '二级代码',
          fieldName: 'sysCode2',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '二级名称',
          fieldName: 'sysName2',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '三级代码',
          fieldName: 'sysCode3',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '三级名称',
          fieldName: 'sysName3',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '故障代码',
          fieldName: 'sysCode4',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'INPUT',
          label: '故障名称',
          fieldName: 'sysName4',
          placeholder: '请输入...',
          readonly: true, // 只读
          disabled: true, // 置会
        },
        {
          type: 'TEXT_AREA',
          label: '案例描述',
          fieldName: 'caseInfo',
          selfCols: 3, // 元素占据几行
          rows: 4,
          maxlength: 500,
          rules: [{ required: true, message: '请输入维修结果', trigger: 'blur' }],
        },
        {
          type: 'TEXT_AREA',
          label: '建议',
          fieldName: 'addviseInfo',
          selfCols: 3, // 元素占据几行
          rows: 3,
        },
        {
          type: 'UPLOAD_FILE',
          label: '上传文件',
          fieldName: 'file1List',
          placeholder: '上传文件...',
          initialValue: [],
          upload: {
            actionUrl: '/api/file/oss/upload',
            limit: 2,
            // tipText: '只能上传pdf格式'
          },
        },
      ];
    },
    // //历史审核记录
    // creatHeader3() {
    //   return [
    //     {
    //       title: '序号',
    //       dataIndex: 'index',
    //       width: 80,
    //       sorter: true,
    //       render: props => {
    //         return <span>{props.row.index + 1}</span>;
    //       }
    //     },
    //     {title: '操作人', dataIndex: 'checkBy', sorter: true},
    //     {title: '操作时间', dataIndex: 'checkAt', sorter: true},
    //     {title: '操作类型', dataIndex: 'checkStatus', sorter: true},
    //     {title: '操作备注', dataIndex: 'checkRemarks', sorter: true}
    //   ];
    // },
    //故障码列表
    creatHeader3() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        { title: '故障码', dataIndex: 'faultCode', sorter: true },
        { title: '故障码描述', dataIndex: 'faultName', sorter: true },
        { title: '出现次数', dataIndex: 'num', sorter: true },
      ];
    },
    //配件列表
    creatHeader4() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        { title: '配件代码', dataIndex: 'partCode', sorter: true },
        { title: '配件名称', dataIndex: 'partName', sorter: true },
      ];
    },
    aduitFormList() {
      return [
        {
          type: 'TEXT_AREA',
          label: '审核备注',
          fieldName: 'checkRemarks',
          selfCols: 3, // 元素占据几行
          rows: 3,
          rules: [{ required: true, message: '请输入审核备注', trigger: 'blur' }],
        },
      ];
    },
  },
};
</script>

<style lang="less" scoped></style>
